unit uniCadFaca;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, uniCadPadrao, DB, ADODB, ExtCtrls, Buttons, DBCtrls, StdCtrls,
  Mask;

type
  TfrmCadFaca = class(TfrmCadPadrao)
    Label2: TLabel;
    DBEdit2: TDBEdit;
    Label1: TLabel;
    DBEdit1: TDBEdit;
    Label3: TLabel;
    DBText1: TDBText;
    procedure DBEdit2Enter(Sender: TObject);
    procedure DBEdit2Exit(Sender: TObject);
    procedure FormShow(Sender: TObject);
  private
    procedure p_Select;
  public
    { Public declarations }
  end;

var
  frmCadFaca: TfrmCadFaca;

implementation

uses UniFuncoes;

{$R *.dfm}

procedure TfrmCadFaca.DBEdit2Enter(Sender: TObject);
begin
  inherited;
  setCorEnter(Sender);
end;

procedure TfrmCadFaca.DBEdit2Exit(Sender: TObject);
begin
  inherited;
  setCorExit(Sender);
end;

procedure TfrmCadFaca.p_Select;
var sSQL : String;
begin
  sSQL := ' SELECT * FROM TB_FACA WHERE 1=1';
  if sCdCampo <> '' then
    sSQL := sSQL + ' AND cd_faca LIKE '+QuotedStr(sCdCampo);
  QR_Padrao.Close;
  QR_Padrao.SQL.Clear;
  QR_Padrao.SQL.Add(sSQL);
  QR_Padrao.Open;
  QR_Padrao.First;
end;

procedure TfrmCadFaca.FormShow(Sender: TObject);
begin
  p_Select;
  inherited;
end;

end.
